//
//  SLUpdateInstallView.m
//  SlockApp
//
//  Created by 凯朱 on 2024/7/30.
//

#import "SLUpdateInstallView.h"

@implementation SLUpdateInstallView
-(void)awakeFromNib{
    [super awakeFromNib];
    _list.layer.cornerRadius = 2;
    _list.layer.masksToBounds = YES;
    _tipLbl.text = kLocalString(@"Follow the steps to update");
    NSString *desc = kLocalString(@"Keep your phone around <1> in 10ft.");
    desc = [desc stringByReplacingOccurrencesOfString:@"<1>" withString:kCurClickDevice.productName];
    _tipLbl1.text = desc;
    _bgView.layer.cornerRadius = 10;
    _bgView.layer.masksToBounds = YES;
    
    _tipLbl2.text = kLocalString(@"Unlock the padlock.");
    _tipLbl3.text = kLocalString(@"Make sure the battery is above 30%.");
    
    _icon1.layer.cornerRadius = 3;
    _icon1.layer.masksToBounds = YES;
    _icon2.layer.cornerRadius = 3;
    _icon2.layer.masksToBounds = YES;
    _icon3.layer.cornerRadius = 3;
    _icon3.layer.masksToBounds = YES;
    _sureBtn.btnStyle = 1;
    [_sureBtn setTitle:kLocalString(@"Start install") forState:UIControlStateNormal];
    
    kWeakSelf(self);
    _grayView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
        [weakself removeWithAnimation];
    }];
    [_grayView addGestureRecognizer:tap];
    _hideView.userInteractionEnabled = YES;
    UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeDown:)];
    swipeRight.direction = UISwipeGestureRecognizerDirectionDown;
    [_hideView addGestureRecognizer:swipeRight];
}

// 手势处理方法
-(void)handleSwipeDown:(UISwipeGestureRecognizer *)gesture {
    [self removeWithAnimation];
}

- (IBAction)sureAction:(id)sender {
    if (self.btnBlock) {
        self.btnBlock(1);
    }
}


@end
